import requests from "@/api/axios";
import mockRequests from "@/api/mockAjax";

// 三级联动接口地址：/api/product/getBaseCategoryList

// export const reqCategoryList = () => {
//     return requests({
//         url: 'product/getBaseCategoryList',//之前配置的时候已经加上了前缀"api",
//         method: 'get',
//     })
// }
export const reqCategoryList = () => requests({
    url: 'product/getBaseCategoryList',//之前配置的时候已经加上了前缀"api",
    method: 'get',
})//简写形式

export const reqGetBannerList = () => mockRequests({
    url: '/banner',//之前配置的时候已经加上了前缀"api",
    method: 'get',
})//简写形式

export const reqGetFloorList = () => mockRequests({
    url: '/floor',//之前配置的时候已经加上了前缀"api",
    method: 'get',
})//简写形式

export const reqGetSearchInfo = (data) => requests(({
    url: '/list',
    method: 'post',
    data//data至少为{}，不能时undefined
}))

export const reqGetDetailInfo = (skuId) => requests(({
    url: `/item/${skuId}`,
    method: 'get'
}))

export const reqAddOrUpdateShopCart = (skuId, skuNum) => requests(({
    url: `/cart/addToCart/${skuId}/${skuNum}`,
    method: 'post'
}))

export const reqGetCartList = () => requests(({
    url: `/cart/cartList`,
    method: 'get'
}))

export const reqDeleteCartById = (skuId) => requests(({
    url: `/cart/deleteCart/${skuId}`,
    method: 'delete'
}))

export const reqUpdateIsCheckedById = (skuId, isChecked) => requests(({
    url: `/cart/checkCart/${skuId}/${isChecked}`,
    method: 'get'
}))

export const reqGetVerificationCode = (phoneNumber) => requests(({
    url: `/user/passport/sendCode/${phoneNumber}`,
    method: 'get'
}))

export const reqCompleteRegister = (data) => requests(({
    url: `/user/passport/register`,
    method: 'post',
    data
}))

export const reqLogin = (data) => requests(({
    url: `/user/passport/login`,
    method: 'post',
    data
}))

export const reqGetUserInfo = () => requests(({
    url: `/user/passport/auth/getUserInfo`,
    method: 'get',
}))

export const reqExitLogin = () => requests(({
    url: `/user/passport/logout`,
    method: 'get',
}))

export const reqGetUserAddressList = () => requests(({
    url: `/user/userAddress/auth/findUserAddressList`,
    method: 'get',
}))

export const reqGetOrderInfo = () => requests(({
    url: `/order/auth/trade`,
    method: 'get',
}))

export const reqSendOrder = (tradeNo, data) => requests(({
    url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,
    method: 'post',
    data
}))

export const reqGetPayInfo = (orderId) => requests(({
    url: `/payment/weixin/createNative/${orderId}`,
    method: 'get'
}))

export const reqGetPayStatement = (orderId) => requests(({
    url: `/payment/weixin/queryPayStatus/${orderId}`,
    method: 'get'
}))

export const reqGetCenterInfo = (page, limit) => requests(({
    url: `/order/auth/${page}/${limit}`,
    method: 'get'
}))